﻿package Interface.Top100Classes
{	
	import Interface.SelectableLabel;
	import Fonts.FranclinGothicDemi;
	import GameUtils.BattleRequestData;
	import GameUtils.TrackData;
	
	import flash.display.Sprite;
	import flash.text.TextField;	
	import flash.text.TextFormat;		
	
	public class TopLabel extends SelectableLabel
	{
		private var FCover:Sprite;
		private var FBackground:Sprite;
		private var FUID:String;
		private var FRatingText:TextField;
		
		public function TopLabel(AUID:String, AName:String, ARating:String):void
		{
			FUID = AUID;
			var vFont:FranclinGothicDemi = new FranclinGothicDemi();
			var vFormat:TextFormat = new TextFormat(vFont.fontName);
			vFormat.size = 14;			
			vFormat.align = 'left';
			
			var vRatingFormat:TextFormat = new TextFormat(vFont.fontName);
			vRatingFormat.size = 14;			
			vRatingFormat.align = 'right';
			
			FBackground = new Sprite();			
			addChild(FBackground);
			
			FText = new TextField();						
			FText.embedFonts = true;
			FText.defaultTextFormat = vFormat;			
			FText.selectable = false;			
			FText.text = AName;
			FText.height = 26;
			FText.width = 288;
			FText.textColor = 0xFFFFFF;
			addChild(FText);
			
			FRatingText = new TextField();						
			FRatingText.embedFonts = true;
			FRatingText.defaultTextFormat = vRatingFormat;			
			FRatingText.selectable = false;
			FRatingText.text = ARating;
			FRatingText.height = 26;
			FRatingText.width = 145;
			FRatingText.textColor = 0x3EFF67;
			FRatingText.x = 288;			
			addChild(FRatingText);
			
			FCover = new Sprite();
			FCover.graphics.beginFill(0x000000, 0);
			FCover.graphics.drawRect(0, 0, width, height);
			FCover.graphics.endFill();
			FCover.buttonMode = true;
			FCover.useHandCursor = true;
			addChild(FCover);
			
			FBackground.graphics.beginFill(0x000000, 0.5);
			FBackground.graphics.drawRect(0, 0, width, height);
			FBackground.graphics.endFill();
			
			super();
		}	
				
		public function get UID():String
		{
			return FUID;
		}
		
		public function get Rating():int
		{
			return int(FRatingText.text);
		}
		
		public function get Name():String
		{
			return FText.text;
		}
		
		public function set Place(APlace:int):void
		{
			FText.text = APlace.toString() + '. ' + FText.text;
		}
	}	
}
